package common

const MAX_IOV_COUNT = 6
const MAX_LOOP_COUNT = 32
const MAX_OP_COUNT = 512
const SYSCALL_MAX_OP_COUNT = 256
const STACK_MAX_OP_COUNT = 64
const MAX_STRCMP_LEN = 256
const MAX_BUF_READ_SIZE = 4096
const STRARR_MAGIC_LEN = 0xffff0000

const (
	REG_ARM_R0 uint32 = iota
	REG_ARM_R1
	REG_ARM_R2
	REG_ARM_R3
	REG_ARM_R4
	REG_ARM_R5
	REG_ARM_R6
	REG_ARM_R7
	REG_ARM_R8
	REG_ARM_R9
	REG_ARM_R10
	REG_ARM_FP
	REG_ARM_IP
	REG_ARM_SP
	REG_ARM_LR
	REG_ARM_PC
	REG_ARM_MAX
)

var RegsArmIdxMap map[uint32]string = map[uint32]string{
	REG_ARM_R0:  "r0",
	REG_ARM_R1:  "r1",
	REG_ARM_R2:  "r2",
	REG_ARM_R3:  "r3",
	REG_ARM_R4:  "r4",
	REG_ARM_R5:  "r5",
	REG_ARM_R6:  "r6",
	REG_ARM_R7:  "r7",
	REG_ARM_R8:  "r8",
	REG_ARM_R9:  "r9",
	REG_ARM_R10: "r10",
	REG_ARM_FP:  "fp",
	REG_ARM_IP:  "ip",
	REG_ARM_SP:  "sp",
	REG_ARM_LR:  "lr",
	REG_ARM_PC:  "pc",
}

var RegsArmNameMap map[string]uint32 = map[string]uint32{
	"r0":  REG_ARM_R0,
	"r1":  REG_ARM_R1,
	"r2":  REG_ARM_R2,
	"r3":  REG_ARM_R3,
	"r4":  REG_ARM_R4,
	"r5":  REG_ARM_R5,
	"r6":  REG_ARM_R6,
	"r7":  REG_ARM_R7,
	"r8":  REG_ARM_R8,
	"r9":  REG_ARM_R9,
	"r10": REG_ARM_R10,
	"fp":  REG_ARM_FP,
	"ip":  REG_ARM_IP,
	"sp":  REG_ARM_SP,
	"lr":  REG_ARM_LR,
	"pc":  REG_ARM_PC,
}

const (
	REG_ARM64_X0 uint32 = iota
	REG_ARM64_X1
	REG_ARM64_X2
	REG_ARM64_X3
	REG_ARM64_X4
	REG_ARM64_X5
	REG_ARM64_X6
	REG_ARM64_X7
	REG_ARM64_X8
	REG_ARM64_X9
	REG_ARM64_X10
	REG_ARM64_X11
	REG_ARM64_X12
	REG_ARM64_X13
	REG_ARM64_X14
	REG_ARM64_X15
	REG_ARM64_X16
	REG_ARM64_X17
	REG_ARM64_X18
	REG_ARM64_X19
	REG_ARM64_X20
	REG_ARM64_X21
	REG_ARM64_X22
	REG_ARM64_X23
	REG_ARM64_X24
	REG_ARM64_X25
	REG_ARM64_X26
	REG_ARM64_X27
	REG_ARM64_X28
	REG_ARM64_X29
	REG_ARM64_LR
	REG_ARM64_SP
	REG_ARM64_PC
	REG_ARM64_MAX
)

var RegsNameMap map[string]uint32 = map[string]uint32{
	"x0":  REG_ARM64_X0,
	"x1":  REG_ARM64_X1,
	"x2":  REG_ARM64_X2,
	"x3":  REG_ARM64_X3,
	"x4":  REG_ARM64_X4,
	"x5":  REG_ARM64_X5,
	"x6":  REG_ARM64_X6,
	"x7":  REG_ARM64_X7,
	"x8":  REG_ARM64_X8,
	"x9":  REG_ARM64_X9,
	"x10": REG_ARM64_X10,
	"x11": REG_ARM64_X11,
	"x12": REG_ARM64_X12,
	"x13": REG_ARM64_X13,
	"x14": REG_ARM64_X14,
	"x15": REG_ARM64_X15,
	"x16": REG_ARM64_X16,
	"x17": REG_ARM64_X17,
	"x18": REG_ARM64_X18,
	"x19": REG_ARM64_X19,
	"x20": REG_ARM64_X20,
	"x21": REG_ARM64_X21,
	"x22": REG_ARM64_X22,
	"x23": REG_ARM64_X23,
	"x24": REG_ARM64_X24,
	"x25": REG_ARM64_X25,
	"x26": REG_ARM64_X26,
	"x27": REG_ARM64_X27,
	"x28": REG_ARM64_X28,
	"x29": REG_ARM64_X29,
	"lr":  REG_ARM64_LR,
	"sp":  REG_ARM64_SP,
	"pc":  REG_ARM64_PC,
}

var RegsIdxMap map[uint32]string = map[uint32]string{
	REG_ARM64_X0:  "x0",
	REG_ARM64_X1:  "x1",
	REG_ARM64_X2:  "x2",
	REG_ARM64_X3:  "x3",
	REG_ARM64_X4:  "x4",
	REG_ARM64_X5:  "x5",
	REG_ARM64_X6:  "x6",
	REG_ARM64_X7:  "x7",
	REG_ARM64_X8:  "x8",
	REG_ARM64_X9:  "x9",
	REG_ARM64_X10: "x10",
	REG_ARM64_X11: "x11",
	REG_ARM64_X12: "x12",
	REG_ARM64_X13: "x13",
	REG_ARM64_X14: "x14",
	REG_ARM64_X15: "x15",
	REG_ARM64_X16: "x16",
	REG_ARM64_X17: "x17",
	REG_ARM64_X18: "x18",
	REG_ARM64_X19: "x19",
	REG_ARM64_X20: "x20",
	REG_ARM64_X21: "x21",
	REG_ARM64_X22: "x22",
	REG_ARM64_X23: "x23",
	REG_ARM64_X24: "x24",
	REG_ARM64_X25: "x25",
	REG_ARM64_X26: "x26",
	REG_ARM64_X27: "x27",
	REG_ARM64_X28: "x28",
	REG_ARM64_X29: "x29",
	REG_ARM64_LR:  "lr",
	REG_ARM64_SP:  "sp",
	REG_ARM64_PC:  "pc",
}

const (
	CONST_ARGTYPE_START uint32 = iota
	POINTER
	INT
	UINT
	INT8
	INT16
	INT32
	INT64
	UINT8
	UINT16
	UINT32
	UINT64
	NUM
	STRING
	STD_STRING
	STRUCT
	ARRAY
	BUFFER
	IOVEC
	MSGHDR
	SOCKLEN_T
	SIZE_T
	SSIZE_T
	SOCKADDR
	TIMESPEC
	STAT
	POLLFD
	SIGACTION
	SIGINFO
	STACK_T
	LINUX_DIRENT64
	STRING_ARRAY
	ITTMERSPEC
	RUSAGE
	UTSNAME
	TIMEVAL
	TIMEZONE
	SYSINFO
	STATFS
	EPOLLEVENT
	INT_ARRAY_1
	INT_ARRAY_2
	SIGINFO_V2
	UINT_ARRAY_1
	SIGSET
	INT_PTR
	UINT_PTR
	BUFFER_X2
	IOVEC_X2
	INT_FCNTL_FLAGS
	INT_STATX_FLAGS
	INT_UNLINK_FLAGS
	INT_SOCKET_FLAGS
	INT_FILE_FLAGS
	INT16_PERM_FLAGS
	CONST_ARGTYPE_END
)

const (
	NO_EVENT uint8 = iota
	COMMON_EVENT
	BRK_EVENT
	UPROBE_EVENT
	SYSCALL_EVENT
)
